package clientGUI.user.Controllers.ISD;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import college.Committee;
import college.User;

import clientGUI.Controllers.Controller;
import clientserver.Client;

public class ChooseCommisionController extends Controller {


	private ArrayList<String> candidates; // logins of candidates
	
	
	private Committee committee;

	public String getfirstMember()
	{
	return committee.getfirstMember();	
	}
	public String getsecondMember()
	{
    return committee.getsecondMember();
	}
	public String getchairman()
	{
		return committee.getchairman();

	}
	
public ChooseCommisionController(Client cl)
{
	

	committee= new Committee(cl);
	committee.readCommittee();
	
	candidates= new ArrayList<String>();
	List <User> iseusers=User.GetUsersbyType(cl, "ISE");
	Iterator<User> iter=iseusers.iterator();
	
	while(iter.hasNext())
	{
		User t;
		t=iter.next();

			candidates.add(t.getLogin());
	
	}

}

	public boolean choosecommision (String first, String second,String head)
	{
		
	if (first.equals(second)|first.equals(head)) return false;
	if(second.equals(head)) return false;
	
   committee.setcommision(first, second, head);
	return true;
	
	}
		
	public void savecommision()
	{
		committee.savecommisiontodb();
	}
		
	
	



public  ArrayList<String> getCandidates()
{
	return candidates;
}
	
}
